import fetch from '../../../static/js/common';

/**
 * 获取最新消息
 * @param param
 * @returns {Promise<T | never>}
 */
export function getNews(param) {
  return fetch('/je/product/paas/ketrSyncData/load', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}

/**
 * 获取任务统计数量
 * @param param
 * @returns {Promise<T | never>}
 */
export function loadProTaskCount(param) {
  return fetch('/je/product/paas/vipPlatform/loadProTaskCount', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}

/**
 * 获取指派的任务
 * @param param
 * @returns {Promise<T | never>}
 */
export function getTask(param) {
  return fetch('/je/load', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}

/**
 * 查询升级包
 * @param param
 * @returns {Promise<T | never>}
 */
export function getUpPackage(param) {
  return fetch('/je/product/paas/vipPlatform/getUpPackage', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}

/**
 * 获取数据字典
 * @param param
 * @returns {Promise<T | never>}
 */
export function getdict(param) {
  return fetch('/je/dd/tree/loadTree', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}

/**
 * 获取数据字典
 * @param param
 * @returns {Promise<T | never>}
 */
export function updateReadNum(param) {
  return fetch('/je/product/paas/vipPlatform/updateReadNum', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}

/**
 * 获取数据字典
 * @param param
 * @returns {Promise<T | never>}
 */
export function updateThumbsUp(param) {
  return fetch('/je/product/paas/vipPlatform/updateThumbsUp', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}

/**
 * 获取下载包
 * @param param
 * @returns {Promise<T | never>}
 */
export function downLoadUpPackage(param) {
  return fetch('/je/product/paas/vipPlatform/downLoadUpPackage', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}
/**
 * 查询表单信息
 * @param param
 * @returns {Promise<T | never>}
 */
export function getInfoById(param) {
  return fetch('/je/product/paas/ketrSyncData/getInfoById', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}
/**
 * 查询最新插件
 * @param param
 * @returns {Promise<T | never>}
 */
export function getPluginList(param) {
  return fetch('/je/product/paas/app/downPacage/getPluginInfo', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}
/**
 * 查询顶部appbanner信息
 * @param param
 * @returns {Promise<T | never>}
 */
export function getAppBanner(param) {
  return fetch('/je/product/paas/vipPlatform/getAppUpPackage', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}
/**
 * appbanner立即下载按钮
 * @param param
 * @returns {Promise<T | never>}
 */
export function appBannerDownloadNow(param) {
  return fetch('/je/product/paas/app/downPacage/getWgtInfo', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}
/**
 * 最新插件立即下载按钮
 * @param param
 * @returns {Promise<T | never>}
 */
export function pluginDownloadNow(param) {
  return fetch('/je/product/paas/app/downPacage/downPlugin', {}, {
    type: 'post',
    contentType: 'application/x-www-form-urlencoded',
    data: param,
    isFormSubmit: true,
  })
    .then(data => data)
    .catch();
}
